<%-- 
    Document   : download_submission
    Created on : 2011年8月27日, 上午09:58:44
    Author     : Terry
--%>

<%@page import="unilearn.vo.Role"%>
<%@page import="unilearn.vo.Person"%>
<%@page import="unilearn.bo.AccessValidator"%>
<%@page import="unilearn.bo.SubjectManagement"%>
<%@page import="unilearn.vo.Submission"%>
<%@page import="unilearn.vo.Assignment"%>
<%@page import="unilearn.bo.AssignmentManagement"%>
<%@page import="unilearn.dao.AssignmentDAO"%>
<%@page import="unilearn.vo.Subject"%>
<%@page import="java.util.List"%>
<%@page import="unilearn.dao.SubjectDAO"%>
<%@page import="unilearn.bo.SubmissionManagement"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.web.context.WebApplicationContext"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext());
    SubmissionManagement submMgt = (SubmissionManagement) context.getBean("submMgt");
    AccessValidator vaildater = (AccessValidator) context.getBean("accessValidator");
    SubjectManagement subjectMgt = (SubjectManagement) context.getBean("subjectMgt");
    AssignmentManagement assignMgt = (AssignmentManagement) context.getBean("assignMgt");

    HttpSession s = request.getSession();

    Person person = (Person) s.getAttribute("person");
    Role role = (Role) s.getAttribute("role");

    List<Subject> subs = null;
    if (role.getName().equals("student")) {
        subs = subjectMgt.getStudentSubjects(person);
    } else if (role.getName().equals("staff")) {
        out.print("<p><a href=\"#\" onclick=\"ControlPanel('subject_control')\" > Subject Control</a></p>");
    } else if (role.getName().equals("lecturer")) {
        subs = subjectMgt.getConvernorSubjects(person);
        subs.addAll(subjectMgt.getMarkerSubjects(person));
    } else if (role.getName().equals("administrator")) {
        out.print("<p><a href=\"#\"  onclick=\"ControlPanel('person_control')\" > Person Control</a></p>");
    }

    if (subs == null) {
        return;
    }
    if (role.getName().equals("lecturer")) {
        out.print("<p><a href=\"#\"  onclick=\"create_assignment()\" > Create Assignment</a></p>");
    }
%>
